package com.lkei.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 把时间字符串转成整数类型的时间戳的工具类
 */
public class TimeToTimeStampUtils {

    public static long dateToStamp(String user_time) throws Exception {
        String re_time = null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        long timeStamp;
        Date d;
        try {
            d = sdf.parse(user_time);
            long l = d.getTime();
            String str = String.valueOf(l);
            re_time =str.substring(0, 10);
        } catch(ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        timeStamp = Long.valueOf(re_time);
        return timeStamp;
    }
}
